package com.youan.serve.common;

import com.youan.pangu.core.mvc.listener.ApplicationParameterLoader;
import com.youan.serve.dao.domain.SysArgu;
import com.youan.serve.dao.idao.SysArguMapper;
import com.youan.serve.service.ISysarguService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @description:
 * @author: 辛晟昊
 * @time: 2020/3/9 10:32
 */
public class PanguApplicationParameterLoader implements ApplicationParameterLoader {
    @Autowired
    private ISysarguService sysarguService;

    @Override
    public Map<String, String> getRunningParameter() {
        Map<String, String> result = new HashMap<>();

        List<SysArgu> list = sysarguService.list();
        list.forEach(item -> {
            result.put(item.getArguName(), item.getArguValue());
        });

        return result;
    }
}
